import Vue from 'vue'
import App from './App.vue'
import router from "@/router";
Vue.config.productionTip = false
import 'vant/lib/datetime-picker/style/less'
import 'vant/lib/popup/style/less'
import 'vant/lib/collapse/style/less'
import 'vant/lib/collapse-item/style/less'
import 'vant/lib/toast/style/less'
import {DatetimePicker, Popup, Collapse, CollapseItem, Toast,Icon} from 'vant';
Vue.use(DatetimePicker);
Vue.use(Popup);
Vue.use(Collapse);
Vue.use(CollapseItem);
Vue.use(Toast)
Vue.use(Icon)
router.beforeEach((to, form, next) => {
    if (sessionStorage.getItem('token')) {
        next()
    } else {
        if (to.path === '/login') {
            next()
        } else {
            next({path: '/login', replace: true})
        }
    }
})
new Vue({
    render: h => h(App),
    router,
}).$mount('#app')
